
export default class LocalSave {


  // 保存LocalStorage
  save(key,obj){
    console.log("正在保存key为："+key);
    if (!obj){
      console.log("被保存的对象不存在，不予保存")
      return
    }
    localStorage.setItem(key,JSON.stringify(obj));
  }

  // 获取LocalStorage
  get(key){
    var obj = localStorage.getItem(key);
    if (obj && obj != "undefined"){
      return JSON.parse(obj);
    }

  }

  // 设置LocalStorage
  set(key,value){
    if (!obj){
      console.log("被保存的对象不存在，不予保存")
      return
    }
    localStorage.setItem(key,JSON.stringify(value));
  }

  // 删除LocalStorage
  remove(key){
    localStorage.removeItem(key);
  }


}

